#include "StdAfx.h"
#include "Fare.h"

/******************************************************************************
 * CNode Implementation
 *****************************************************************************/
CFare::CFare(CNode* start, CNode* end)
{
    m_start = start;
    m_end = end;
    m_time = CSysTime::Now();
    m_charge = 0.0;
    m_inProgress = false;
    m_start->m_numFares++;
	m_expire = CSysTime::Now() + 
		CSysTime::Span(CAgentUtils::Random(60, 120), 0);
}

CFare::~CFare()
{
}

void CFare::Start()
{
    m_start->m_numFares--;
}

double CFare::GetCharge()
{
    m_charge = ((int)GetTime() / 60) * F_PER_UNIT + F_BASE_PRICE;
    return m_charge;
}

CSysTime CFare::GetTime()
{
    return CSysTime::Now() - m_time;  //- Seconds since fare start
}

bool CFare::GetInProgress()
{
    return m_inProgress;
}

CSysTime CFare::GetExpire()
{
	return m_expire;
}